<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">

    <ui:composition template="layout.xhtml">
        <ui:define name="body">
            <script>
                function title() {
                    document.getElementById('atendimento').className='selected';
                }
                window.onload=title;
            </script>
            <style>
                .ui-panel .ui-panel-titlebar{
                    color: #0088CC;
                    background: none repeat scroll 0 0 #FFFFFF !important;
                }
            </style>
            <f:metadata>
                <f:viewParam name="date" value="#{managerAtendimento.dateString}"/>
            </f:metadata>
            <h:form id="diaryForm" enctype="multipart/form-data" >
                <h1 class="title">
                    <a href="#" class="back" onclick="history.go(-1)"/>
                    Atendimento
                </h1>
                <p:messages autoUpdate="true" showDetail="true" id="messages" closable="true"/>
                <div class="row">
                    <div class="twelve columns">
                        <div class="container_24 clearfix ">
                            <div class="clear"/>
                            <fieldset style="margin: 0px;">
                                <legend>  <h5>
                                        <h:outputText  value="#{managerAtendimento.customer.gender eq 'MASCULINO' ?
                                                                'Sr. ':'Sra. '}#{managerAtendimento.customer.name}"/>
                                        <h:outputText  value="#{managerAtendimento.age ne '0' ? ' - ' : ''}#{managerAtendimento.age ne '0' ?
                                                                managerAtendimento.age : ''}#{managerAtendimento.age ne '0' ? ' Anos' : ''}"/>
                                    </h5></legend>

                                <p:panel id="atendimentoperfil" 
                                         style="background: none; border: none; margin: 0px;" 
                                         styleClass="container_24 clearfix">


                                    <p:panel header="Perfil" styleClass="grid_5" style="text-align: center;">
                                        <p:graphicImage id="avatar1" styleClass="image grid_3" 
                                                        style="margin-left:1%; width: 120px;" 
                                                        alt="#{managerAtendimento.customer.annex.id}" 
                                                        title="#{managerAtendimento.customer.annex.id}"
                                                        url="#{managerAtendimento.customer.annex.id eq null ? '':'show/?annex='}#{managerAtendimento.customer.annex.id eq null ? 'assets/images/avatar.jpg': managerAtendimento.customer.annex.id}" />
                                        <div class="clear"></div>

                                        <div class="grid_24" style="text-align: left; ">

                                            <h:outputText  value="Idade:" styleClass="grid_13" style="font-weight: bold; "/>
                                            <h:outputText  value="#{managerAtendimento.age ne '0' ? ' ' : ''}
                                                           #{managerAtendimento.age ne '0' ?
                                                             managerAtendimento.age : ''}
                                                           #{managerAtendimento.age ne '0' ? ' Anos' : ''}"
                                                           styleClass="grid_9"/>

                                            <h:outputText value="Estado Civil:" styleClass="grid_15" style="font-weight: bold;"/>
                                            <h:outputText styleClass="grid_8" value="#{managerAtendimento.customer.civilStatus.name}"/>
                                            <div class="clear"></div>
                                            <h:outputText value="Telefones:" styleClass="grid_13" style="font-weight: bold;"/>
                                            <div class="clear"></div>
                                            <h:outputText styleClass="grid_23 push_7" value="#{managerAtendimento.customer.phone}"/>
                                            <div class="clear"></div>
                                            <h:outputText styleClass="grid_23 push_7" value="#{managerAtendimento.customer.cellular}"/>
                                            <div class="clear"></div>
                                            <h:outputText value="E-mail:" styleClass="grid_13" style="font-weight: bold;"/>
                                            <h:outputText styleClass="grid_12" value="#{managerAtendimento.customer.email}"/>
                                            <div class="clear"></div>
                                            <p:button outcome="editcustomer.xhtml"
                                                      value="Atualizar Informações" icon="ui-icon-refresh"
                                                      styleClass="grid_24">
                                                <f:param name="atendimentoperfil" value="true" />
                                                <f:param name="customerEdit" value="#{managerAtendimento.customer.id}" />
                                                <f:param name="date" value="#{managerAtendimento.dateString}" />
                                            </p:button>
                                            <div class="clear"></div>
                                            <p:button icon="ui-icon-plus"
                                                      outcome="atendimentoprocedimento.xhtml"  value="Nova Consulta" 
                                                      styleClass="ui-priority-primary grid_24">
                                                <f:param name="step" value="3" />
                                                <f:param name="customer" value="#{managerAtendimento.customer.id}" />
                                                <f:param name="date" value="#{managerAtendimento.dateString}" />
                                            </p:button>
                                            <p:button icon="ui-icon-plus"
                                                      outcome="atendimentoprocedimento.xhtml"  value="Novo Exame" 
                                                      styleClass="ui-priority-primary grid_24">
                                                <f:param name="step" value="3" />
                                                <f:param name="customer" value="#{managerAtendimento.customer.id}" />
                                                <f:param name="date" value="#{managerAtendimento.dateString}" />
                                            </p:button>

                                        </div>
                                    </p:panel>
                                    <div class="grid_18">
                                        <p:tabView id="tabView">
                                            <p:tab id="tba0" title="Atividades Recentes" >
                                                <div class="ui-messages ui-widget" style="display: #{managerAtendimento.verificaCadastroIncompleto() ? 'block':'none'}">
                                                    <div class="ui-messages-error ui-corner-all">
                                                        <span class="ui-messages-error-icon"/>
                                                        <span class="ui-messages-error-summary">Cadastro Incompleto</span>
                                                    </div>
                                                </div>
                                                <div class="ui-messages ui-widget" style="display: #{managerAtendimento.msg ne null ? 'block':'none'}">
                                                    <div class="ui-messages-warn ui-corner-all">
                                                        <span class="ui-messages-warn-icon"/>
                                                        <ul>                                                            
                                                            <h:outputText value="#{managerAtendimento.msg}" escape="false"/>
                                                        </ul>
                                                    </div>
                                                </div>
                                                <div class="container_24 clearfix">
                                                    <p:dataTable id="searchDiary" styleClass="grid_24" var="sd" 
                                                                 rowIndexVar="ddt" emptyMessage="Nenhum Agendamento Realizado"
                                                                 paginator="true" rows="10" paginatorPosition="bottom"
                                                                 value="#{managerAtendimento.diarysRecents}"  >

                                                        <f:facet name="header">
                                                            Agendamentos (#{managerAtendimento.diarysRecents.size()})
                                                        </f:facet>

                                                        <p:column headerText="Ação" style="white-space: pre-wrap;" width="25">  
                                                            <p:button icon="ui-icon-search" outcome="atendimentoprocedimento.xhtml" 
                                                                      style="width: 25px; position: relative">
                                                                <f:param name="step" value="3"  />
                                                                <f:param name="diary" value="#{sd.id}" />
                                                            </p:button>
                                                            
                                                        </p:column>
                                                        <p:column headerText="Data" style="white-space: pre-wrap;" width="75">  
                                                            <h:outputText value="#{sd.startTime}" >  
                                                                <f:convertDateTime pattern="dd/MM/yyy HH:mm:ss "  locale="pt"/>
                                                            </h:outputText>
                                                        </p:column>

                                                        <p:column headerText="Status" style="white-space: pre-wrap;" width="120">  
                                                            <h:outputText value="#{sd.diarySituation.toString()}" />  
                                                        </p:column>

                                                        <p:column headerText="Médico">  
                                                            <h:outputText value="#{sd.doctor.name}" />  
                                                        </p:column>

                                                        <p:column headerText="Procedimento">  
                                                            <h:outputText value="#{sd.retorno ? 'RETORNO - ':''}#{sd.procedure.name}" />  
                                                        </p:column>

                                                    </p:dataTable>
                                                </div>
                                            </p:tab>
                                            <p:tab id="tba1" title="Dados do Paciente" >

                                                <fieldset style="margin: 0;">
                                                    <legend> <h5 style="margin:0 0 10px 0">Dados Gerais</h5></legend>
                                                    <p:panel id="customerPrimary" 
                                                             style="background: none; border: none;width: 100%; margin: 0px; padding: 0;" 
                                                             styleClass="grid_24">


                                                        <p:outputLabel for="name" value="Nome :" styleClass="grid_3"/>
                                                        <p:inputText id="name" readonly="true" styleClass="grid_20" value="#{managerAtendimento.customer.name}"/>

                                                        <p:outputLabel for="dataNasc" value="Data Nasc.:" styleClass="grid_4"
                                                                       style="margin-left: -18px;"/>
                                                        <p:inputText id="dataNasc" styleClass="grid_8" readonly="true"
                                                                     value="#{managerAtendimento.customer.dateBirth}">
                                                            <f:convertDateTime pattern="dd/MM/yyyy"/>
                                                        </p:inputText>

                                                        <p:outputLabel for="email" value="E-mail :" styleClass="grid_3" style="margin-left: -3px"/>
                                                        <p:inputText id="email" styleClass="grid_8" readonly="true"
                                                                     value="#{managerAtendimento.customer.email}" style="width: 35.5%"/>

                                                        <p:outputLabel for="phone" value="Telefone :" styleClass="grid_3"/>
                                                        <p:inputMask id="phone" mask="(99) 9999-9999" readonly="true" styleClass="grid_8" value="#{managerAtendimento.customer.phone}"/>

                                                        <p:outputLabel for="cellular" value="Celular :" style="margin-left: -3px" styleClass="grid_3"/>
                                                        <p:inputMask id="cellular" mask="(99) 9999-9999" readonly="true"  styleClass="grid_8" style="width: 35.5%" value="#{managerAtendimento.customer.cellular}"/>

                                                        <p:outputLabel value="Estado Civil:"  styleClass="grid_4" style="margin-left: -21px;"/>
                                                        <div class="grid_8">
                                                            <p:selectOneMenu style="width: 103.5%; height: 21px;" disabled="true" value="#{managerAtendimento.customer.civilStatus}">  
                                                                <f:selectItem itemLabel="" itemValue="" />  
                                                                <f:selectItems value="#{managerCustomer.selectCivilStatus()}" />  
                                                            </p:selectOneMenu> 
                                                        </div>
                                                        <p:outputLabel value="Sexo : " styleClass="grid_3"/>
                                                        <div class="grid_8">
                                                            <p:selectOneMenu style="width: 117.5%; height: 21px;" disabled="true" panelStyle="width:150px;" value="#{managerAtendimento.customer.gender}" >   
                                                                <f:selectItem itemLabel="" itemValue="" />  
                                                                <f:selectItems value="#{managerCustomer.gender}" />  
                                                            </p:selectOneMenu> 
                                                        </div>

                                                    </p:panel>
                                                </fieldset>
                                                <fieldset>
                                                    <legend> <h5 style="margin:0 0 10px 0">Dados Complementares</h5></legend>
                                                    <p:panel id="customerSecundary" style="background: none; border: none;" 
                                                             styleClass="container_24 clearfix ">
                                                        <p:outputLabel value="CPF:" styleClass="grid_3"/>
                                                        <p:inputMask mask="999.999.999-99" readonly="true" styleClass="grid_8" value="#{managerAtendimento.customer.cpf}"/>

                                                        <p:outputLabel value="RG:" styleClass="grid_4"/>
                                                        <p:inputText styleClass="grid_8" readonly="true" value="#{managerAtendimento.customer.rg}"/>

                                                        <p:outputLabel value="Profissão:" styleClass="grid_3"/>
                                                        <p:inputText styleClass="grid_20" style="width: 83.3%" readonly="true" value="#{managerAtendimento.customer.occupation}"/>

                                                        <p:outputLabel value="Mãe:" styleClass="grid_3"/>
                                                        <p:inputText styleClass="grid_8" readonly="true" value="#{managerAtendimento.customer.filiationMother}"/>
                                                        <p:outputLabel value="Profissão:" styleClass="grid_4"/>
                                                        <p:inputText styleClass="grid_8" readonly="true" value="#{managerAtendimento.customer.occupationMother}"/>
                                                        <div class="clear"/>
                                                        <p:outputLabel value="Pai:" styleClass="grid_3"/>
                                                        <p:inputText styleClass="grid_8" readonly="true" value="#{managerAtendimento.customer.filiationFather}"/>
                                                        <p:outputLabel value="Profissão:" styleClass="grid_4"/>
                                                        <p:inputText styleClass="grid_8" readonly="true" value="#{managerAtendimento.customer.occupationFather}"/>
                                                        <div class="clear"/>
                                                        <p:outputLabel value="Responsável:" styleClass="grid_4"
                                                                       style="margin-left: -18px;"/>
                                                        <p:inputText styleClass="grid_20" style="width: 83.3%"
                                                                     readonly="true" value="#{managerAtendimento.customer.responsible}"/>

                                                    </p:panel>
                                                </fieldset>
                                                <fieldset>
                                                    <legend> <h5 style="margin:0 0 10px 0">Endereço</h5></legend>
                                                    <p:panel id="address" style="background: none; border: none;" 
                                                             styleClass="container_24 clearfix ">

                                                        <p:outputLabel value="CEP :" styleClass="grid_3" />
                                                        <p:inputText styleClass="grid_8" readonly="true"
                                                                     value="#{managerAtendimento.address.zipcode}" />

                                                        <div class="clear"/>
                                                        <p:outputLabel value="Logradouro :" styleClass="grid_4" style="margin-left: -18px;"/>
                                                        <p:inputText styleClass="grid_20" style="width: 82.5%" readonly="true" value="#{managerAtendimento.address.publicPark}" />
                                                        <div class="clear"/>
                                                        <p:outputLabel value="Bairro :" styleClass="grid_3" />
                                                        <p:inputText  styleClass="grid_8" readonly="true" value="#{managerAtendimento.address.neighborhood}" />

                                                        <p:outputLabel value="Nº :" styleClass="grid_3" />
                                                        <p:inputText styleClass="grid_9" readonly="true" value="#{managerAtendimento.address.number}" />
                                                        <div class="clear"/>

                                                        <p:outputLabel value="Complemento :" styleClass="grid_5" style="margin-left: -42px;"/>
                                                        <p:inputText styleClass="grid_8" readonly="true" value="#{managerAtendimento.address.complement}" />

                                                        <p:outputLabel  value="Cidade :" styleClass="grid_3"  />
                                                        <p:inputText styleClass="grid_9"  readonly="true"  value="#{managerAtendimento.address.city.name}"/> 
                                                    </p:panel>
                                                </fieldset>
                                                <fieldset>
                                                    <legend> <h5 style="margin:0 0 10px 0">Plano de Saúde</h5></legend>
                                                    <p:panel id="customerplain" style="background: none; border: none;" 
                                                             styleClass="container_24 clearfix ">
                                                        <p:outputLabel value="Operadora:" styleClass="grid_3"/>
                                                        <p:inputText value="#{managerAtendimento.operator.name}"
                                                                     styleClass="grid_20" readonly="true" />
                                                        <div class="clear"/>
                                                        <p:outputLabel value="Nº Carteirinha:" styleClass="grid_5"
                                                                       style="margin-left: -42px;"/>
                                                        <p:inputText styleClass="grid_8" readonly="true" value="#{managerAtendimento.customer.cardNumber}"/>
                                                        <p:outputLabel value="Validade:" styleClass="grid_4"/>
                                                        <p:inputText styleClass="grid_8" readonly="true" value="#{managerAtendimento.customer.validateCard}"/>

                                                    </p:panel>
                                                </fieldset>
                                            </p:tab>
                                            <p:tab id="tba2" title="Histórico Clínico" rendered="false">

                                                <h:outputLabel value="Não há registro clínico"
                                                               styleClass="grid_7"
                                                               rendered="#{empty managerAtendimento.recordses}"/>
                                                
                                                <ui:repeat value="#{managerAtendimento.recordses}" var="r">

                                                    <div class="container_24 clearfix">
                                                        <div class="grid_3">
                                                            <p class="date">
                                                                <a href="#">
                                                                    <h:outputText value="#{r.createAt}">
                                                                        <f:convertDateTime pattern="MMMMM" />
                                                                    </h:outputText>
                                                                    <b>
                                                                        <h:outputText value="#{r.createAt}">
                                                                            <f:convertDateTime pattern="dd"/>
                                                                        </h:outputText>

                                                                    </b>
                                                                    <span>
                                                                        <h:outputText value="#{r.createAt}">
                                                                            <f:convertDateTime pattern="yyyy"/>
                                                                        </h:outputText>
                                                                    </span>
                                                                </a>
                                                            </p>
                                                        </div>
                                                        <p:panel style="background: none; margin:none;" 
                                                                 styleClass="grid_20" 
                                                                 collapsed="true" toggleable="true" >

                                                            <f:facet name="header">
                                                                <div class="grid_22 clearfix">

                                                                    <div class="grid_18">
                                                                        <h:outputText value="#{r.procedure.typeProcedure.name}:" styleClass="grid_5"/>
                                                                        <h:outputText value="#{r.procedure.typeProcedure.name} #{r.procedure.name}" 
                                                                                      styleClass="grid_19"/>
                                                                        <div class="clear"/>
                                                                        <h:outputText value="Médico Responsável:" styleClass="grid_11"/>
                                                                        <h:outputText value="#{r.doctor.name}" styleClass="grid_9"/>
                                                                        <div class="clear"/>
                                                                        <h:outputText value="Médico Solicitante:" styleClass="grid_10"/>
                                                                        <h:outputText value="#{managerAtendimento.diaryPorRecord(r.id).doctorRequest.name}" 
                                                                                      styleClass="grid_13"/>
                                                                        <div class="clear"/>
                                                                        <h:outputText value="Convênio:" styleClass="grid_5"/>
                                                                        <h:outputText value="#{managerAtendimento.diaryPorRecord(r.id).operator.name}" 
                                                                                      styleClass="grid_13"/>
                                                                    </div>
                                                                    <p:button icon="ui-icon-arrowreturnthick-1-w" 
                                                                              value="Retorno" outcome="createRecords"
                                                                              rendered="true"
                                                                              styleClass="grid_5">
                                                                        <f:param name="c" value="#{r.customer.id}" />
                                                                        <f:param name="r" value="#{r.id}" />
                                                                        <f:param name="p" value="#{r.procedure eq null ? null : r.procedure.id}" />
                                                                        <f:param name="d" value="#{r.doctor eq null ? null : r.doctor.id}" />
                                                                    </p:button>
                                                                </div>
                                                            </f:facet>

                                                            <div class="grid_20" >
                                                                <h4 style="color: #5593CA;">Anamnese</h4>

                                                                <ui:repeat value="#{r.anamneses}" var="ra">
                                                                    <p:outputLabel value="Queixa Principal#{ra.id}" styleClass="grid_5"/>
                                                                    <p:inputText styleClass="grid_18" readonly="true" value="#{ra.chiefComplaint}"/>
                                                                    <div class="clear"/>
                                                                    <p:outputLabel value="História" styleClass="grid_5"/>
                                                                    <div class="grid_18">
                                                                        <p:inputTextarea readonly="true" value="#{ra.descr}"/>
                                                                    </div>
                                                                </ui:repeat>
                                                                <p:outputLabel value="Queixa Principal" styleClass="grid_5" rendered="#{empty r.anamneses}"/>
                                                                <p:inputText styleClass="grid_18" readonly="true" rendered="#{empty r.anamneses}"/>
                                                                <div class="clear"/>
                                                                <p:outputLabel value="História" styleClass="grid_5" rendered="#{empty r.anamneses}"/>
                                                                <div class="grid_18">
                                                                    <p:inputTextarea readonly="true" rendered="#{empty r.anamneses}"/>
                                                                </div>

                                                                <div class="clear"/>
                                                                <hr/>
                                                                <h4 style="color: #5593CA;">Exame Físico</h4>

                                                                <div class="clear"/>
                                                                <p:outputLabel value="Altura" styleClass="grid_5"/>
                                                                <p:inputText styleClass="grid_4" readonly="true" value="#{r.physicalExamination.height}"/>
                                                                <p:outputLabel value="m" styleClass="grid_1"/>
                                                                <p:outputLabel value="Peso" styleClass="grid_5"/>
                                                                <p:inputText styleClass="grid_4" readonly="true" value="#{r.physicalExamination.weight}"/>
                                                                <p:outputLabel value="kg" styleClass="grid_1"/>
                                                                <div class="clear"/>
                                                                <p:outputLabel value="Batimento Cardíaco" styleClass="grid_5"/>
                                                                <p:inputText styleClass="grid_4" readonly="true" value="#{r.physicalExamination.heartRate}"/>
                                                                <p:outputLabel value="bpm" styleClass="grid_1"/>
                                                                <div class="clear"/>
                                                                <p:outputLabel value="Pressão arterial sistólica" styleClass="grid_5"/>
                                                                <p:inputText styleClass="grid_4" readonly="true" value="#{r.physicalExamination.systolicPressure}"/>
                                                                <p:outputLabel value="mmHg" styleClass="grid_1"/>
                                                                <p:outputLabel value="Pressão arterial Diastólica" styleClass="grid_5"/>
                                                                <p:inputText styleClass="grid_4" readonly="true" value="#{r.physicalExamination.diastolicPressure}"/>
                                                                <p:outputLabel value="mmHg" styleClass="grid_1"/>
                                                                <div class="clear"/>
                                                                <p:outputLabel value="Observações" styleClass="grid_5"/>
                                                                <div class="grid_19">
                                                                    <p:inputTextarea readonly="true" value="#{r.physicalExamination.descr}"/>
                                                                </div>
                                                                <div class="clear"/>
                                                                <hr/>
                                                                <h4 style="color: #5593CA;">Diagnóstico</h4>

                                                                <p:outputLabel value="Diagnóstico" styleClass="grid_5"/>
                                                                <p:inputText styleClass="grid_18" readonly="true" value="#{r.diagnostic.cid}"/>
                                                                <div class="clear"/>
                                                                <p:outputLabel value="Conduta" styleClass="grid_5"/>
                                                                <div class="grid_18">
                                                                    <p:inputTextarea readonly="true" value="#{r.diagnostic.descr}"/>
                                                                </div>
                                                                <div class="clear"/>
                                                                <hr/>
                                                                <h4 style="color: #5593CA;">Receituário</h4>
                                                                <p:outputLabel value="Descrição" styleClass="grid_5"/>
                                                                <div class="grid_18">
                                                                    <p:inputTextarea readonly="true" value="#{r.prescription}"/>
                                                                </div>
                                                                <div class="clear"/>
                                                                <hr/>
                                                                <h4 style="color: #5593CA;">Evolução/Retorno</h4>


                                                                <ui:repeat value="#{r.evolutions}" var="ev">

                                                                    <div class="grid_6">
                                                                        <p class="date">
                                                                            <a href="#">
                                                                                <h:outputText value="#{ev.dateEvolution}">
                                                                                    <f:convertDateTime pattern="MMMMM" />
                                                                                </h:outputText>
                                                                                <b>
                                                                                    <h:outputText value="#{ev.dateEvolution}">
                                                                                        <f:convertDateTime pattern="dd"/>
                                                                                    </h:outputText>

                                                                                </b>
                                                                                <span>
                                                                                    <h:outputText value="#{ev.dateEvolution}">
                                                                                        <f:convertDateTime pattern="yyyy"/>
                                                                                    </h:outputText>
                                                                                </span>
                                                                            </a>
                                                                        </p>
                                                                    </div>
                                                                    <div class="grid_18">
                                                                        <p:outputLabel value="Data:" styleClass="grid_4" rendered="false"/>
                                                                        <p:calendar showOn="button" styleClass="grid_19" 
                                                                                    value="#{ev.dateEvolution}" rendered="false"
                                                                                    pattern="dd/MM/yyyy" required="true"/>
                                                                        <div class="clear"></div>
                                                                        <p:outputLabel value="Descrição" styleClass="grid_4"/>
                                                                        <div class="clear"></div>
                                                                        <div class="grid_23">
                                                                            <p:inputTextarea readonly="true" value="#{ev.descr}"/>
                                                                        </div> 
                                                                        <div class="clear"></div>
                                                                    </div>
                                                                    <div class="clear"/>
                                                                </ui:repeat>


                                                                <div class="clear"/>
                                                                <hr/>
                                                                <h4 style="color: #5593CA;">Anexos</h4>

                                                                <div class="container_24 clearfix">
                                                                    <ui:repeat  value="#{r.annexs}" var="a">
                                                                        <div class="grid_5">
                                                                            <h:outputLink  
                                                                                value="#{a.type ne 'application/pdf' ? 'viewImage.xhtml':'show'}" 
                                                                                title="#{a.description}"  target="_blank" >

                                                                                <div style="text-align: center; width: 20%;" class="grid_4">

                                                                                    <p:graphicImage styleClass="image grid_3" rendered="#{a.type ne 'application/pdf'}"
                                                                                                    style="margin-left:1%; width: 100px;"
                                                                                                    url="show/?annex=#{a.id}" />

                                                                                    <p:outputLabel  value="#{a.description.length() ge 10 ? a.description.substring(0, 10).concat('...') : 
                                                                                                             a.description.replace('.png','').replace(' ','_')}" 
                                                                                                    style="margin-left:1%; width: 100px;" rendered="#{a.type ne 'application/pdf'}"/>

                                                                                    <p:graphicImage styleClass="image grid_3" rendered="#{a.type eq 'application/pdf'}"
                                                                                                    style="margin-left:1%; width: 100px;" 
                                                                                                    url="assets/images/pdf.jpeg" />


                                                                                    <p:outputLabel  value="#{a.description.length() ge 10 ? a.description.substring(0, 10).concat('...') : 
                                                                                                             a.description.replace('.pdf','').replace(' ','_')}" 
                                                                                                    style="margin-left:1%; width: 100px;" rendered="#{a.type eq 'application/pdf'}"/>


                                                                                </div>
                                                                                <f:param name="annex" value="#{a.id}"/>
                                                                            </h:outputLink>
                                                                        </div>
                                                                        <div class="grid_18">
                                                                            <p:outputLabel value="Laudo" styleClass="left"/>
                                                                            <div class="clear"/>
                                                                            <div class="grid_23">
                                                                                <p:inputTextarea value="#{a.laudo}" />
                                                                            </div> 
                                                                        </div> 
                                                                        <div class="clear"/>

                                                                    </ui:repeat>
                                                                </div>
                                                                <div class="clear"/>
                                                                <hr/>
                                                            </div>

                                                        </p:panel>
                                                    </div>
                                                </ui:repeat>
                                                <br/>
                                                <br/>
                                                <br/>
                                            </p:tab>
                                        </p:tabView>
                                    </div>
                                </p:panel>
                            </fieldset>
                        </div>
                    </div>
                </div>
            </h:form>
        </ui:define>
    </ui:composition>
</html>
